<?php 
class CabinBookedDates extends DataObject {
	static $db = array(
		"DateFrom" => "Date",
		"DateTo" => "Date",
	    "OccupiedPlaces" => 'Int'
	);
	
	static $has_one = array(
		'Cabin' => 'Cabin',
	);

	public function getCMSFields_forPopup() {
		$fields = self::getFormFields();
		
		return $fields;
	}

    public function DateFromNice() {
        return date('d.m.Y',strtotime($this->DateFrom));
    }
	
	public function DateToNice() {
		return date('d.m.Y',strtotime($this->DateTo));
	}
	
	static public function getFormFields() {
		$fieldset = new FieldSet(
		    new NumericField('OccupiedPlaces','belegte Plätze'),
			new CalendarPickerField('DateFrom','von *'),
			new CalendarPickerField('DateTo','bis')
		);
		return $fieldset;
	}
	
}
?>